
$().ready(function() {
    layui.use('upload', function() {
        var $ = layui.jquery
            , upload = layui.upload;

        //选完文件后不自动上传
        upload.render({
            elem: '#test3'
            ,url: ctx + 'module/shop/readExcelBatchAddNew' //改成您自己的上传接口
            ,auto: false
            //,multiple: true
            ,exts: 'xls|xlsx' //只允许上传压缩文件
            ,bindAction: '#test9'
            , before: function (obj) {
                this.data = {
                    platformId: $('#platformId').val()
                };//关键代码
            }
            ,done: function(res){
                if (res.code == 0) {
                    parent.layer.msg("上传成功");
                    parent.reLoad();
                    var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
                    parent.layer.close(index);

                } else if (res.code == 500) {
                    parent.layer.alert(res.msg)
                } else {
                    window.location.href = ctx + 'module/shop/downloadErrorExcel?fileName=' + res.msg + '&path=companyExcel';
                }
            }
        });



        //选完文件后不自动上传
        upload.render({
            elem: '#test4'
            ,url: ctx + 'module/company/readExcelSysUser' //改成您自己的上传接口
            ,auto: false
            //,multiple: true
            ,exts: 'xls|xlsx' //只允许上传压缩文件
            ,bindAction: '#test10'
            ,done: function(res){
                if (res.code == 0) {
                    parent.layer.msg("上传成功");
                    parent.reLoad();
                    var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
                    parent.layer.close(index);

                } else if (res.code == 500) {
                    parent.layer.alert(res.msg)
                } else {
                    window.location.href = ctx + 'module/shop/downloadErrorExcel?fileName=' + res.msg + '&path=companyExcel';
                }
            }
        });
    });

});
